﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

namespace VirtualOrg.Web.Admin
{
    public partial class MasterData : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnAddCategory_Click(object sender, EventArgs e)
        {
            using (DB.DbStoreDataContext dataContext = new DB.DbStoreDataContext())
            {
                StreamReader sr = File.OpenText(@"E:\codeplex\VirtualOrg\VirtualOrg.Web\Admin\cat.txt");
                while (!sr.EndOfStream)
                {
                    string input = sr.ReadLine();
                    string[] splitStr = input.Split(',');
                    dataContext.AddCategory(Convert.ToInt64(splitStr[0]), splitStr[1], "ORG_TYPE");
                }
            }
        }

        protected void btnAddSubCategory_Click(object sender, EventArgs e)
        {
            using (DB.DbStoreDataContext dataContext = new DB.DbStoreDataContext())
            {
                StreamReader sr = File.OpenText(@"E:\codeplex\VirtualOrg\VirtualOrg.Web\Admin\subcat.txt");
                while (!sr.EndOfStream)
                {
                    string input = sr.ReadLine();
                    string[] splitStr = input.Split(',');
                    dataContext.AddSubCategory(Convert.ToInt64(splitStr[0]), Convert.ToInt64(splitStr[1]), splitStr[2]);
                }
            }
        }
    }
}